package com.xxxy.hyc.xyxmp.bean;

import java.util.List;

public class Order {
    private List<CartItem> items;
    private String address;
    private String remark;
    private int paymentMethod; // 0: 支付宝, 1: 微信支付, 2: 中国农业银行, 3: 中国建设银行, 4: 货到付款

    public Order(List<CartItem> items, String address, String remark, int paymentMethod) {
        this.items = items;
        this.address = address;
        this.remark = remark;
        this.paymentMethod = paymentMethod;
    }

    public List<CartItem> getItems() {
        return items;
    }

    public void setItems(List<CartItem> items) {
        this.items = items;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public int getPaymentMethod() {
        return paymentMethod;
    }

    public void setPaymentMethod(int paymentMethod) {
        this.paymentMethod = paymentMethod;
    }

    public String getPaymentMethodName() {
        switch (paymentMethod) {
            case 0: return "支付宝";
            case 1: return "微信支付";
            case 2: return "中国农业银行";
            case 3: return "中国建设银行";
            case 4: return "货到付款";
            default: return "未知支付方式";
        }
    }

    public double getTotalPrice() {
        double total = 0;
        for (CartItem item : items) {
            total += item.getSubtotal();
        }
        return total;
    }
}